package com.example.a_buffer;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class Demo1OutputStreamWriter {
    public static void main(String[] args) {
        try(FileOutputStream fos = new FileOutputStream("e.txt");
            OutputStreamWriter osw = new OutputStreamWriter(fos, "gbk")) {
            osw.write("你好");
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
